package com.qg612324.dcb.dao.hibernate;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;

@ContextConfiguration( {
	"classpath*:applicationContext-dao.xml",
	"classpath*:applicationContext-datasource.xml", 
	"classpath*:applicationContext-resources.xml",
	"classpath*:applicationContext-service.xml"
	})
public abstract class BaseDaoTestCase extends AbstractTransactionalJUnit4SpringContextTests {

    protected HibernateTemplate hibernateTemplate;

    @Autowired
    public void setSessionFactory(SessionFactory sessionFactory) {
        this.hibernateTemplate = new HibernateTemplate(sessionFactory);
    }

    protected void flushHibernate() {
        hibernateTemplate.flush();
    }

}
